package com.quintilis31.home.core.user.util;

import com.quintilis31.home.common.validation.ValidatorResultType;
import com.quintilis31.home.common.validation.ValidatorType;
import com.quintilis31.home.common.validation.factory.ValidatorFactory;

public final class UserValidationUtil {
	
	public static ValidatorResultType validateFirstName(final String firstName) {
		ValidatorResultType resultType = UserValidationUtil.validate(ValidatorType.FIRSTNAME, firstName);
		return resultType;
	}
	
	public static ValidatorResultType validateLastName(final String lastName) {
		ValidatorResultType resultType = UserValidationUtil.validate(ValidatorType.LASTNAME, lastName);
		return resultType;
	}
	
	public static ValidatorResultType validateEmail(final String email) {
		ValidatorResultType resultType = UserValidationUtil.validate(ValidatorType.EMAIL, email);
		return resultType;
	}
	
	private static ValidatorResultType validate(ValidatorType validatorType, final Object toValidate) {
		ValidatorResultType result = ValidatorFactory.getValidator(validatorType).validate(toValidate);
		return result;		
	}

}
